package com.example.demo;

import com.example.demo.common.utils.demo.*;
import com.example.demo.common.utils.demo.model.*;

import java.util.ArrayList;
import java.util.List;

public class DemoApplication {

	public static void main(String[] args) {

	    /***********1.提交发放******************/
        String payeeName = "";//收款人姓名 必填
        String payeeAccount = "";//收款账户 必填
        String payeeIdCard = "";//收款人身份证号码 必填
        String amount = "";//金额单位为元精确到分 必填
        String thirdOrderId = "";//企业自己生成的订单号，不可重复提交 必填
        String payeePhone = "";//收款人手机号码 非必填
        String payeeBankName = "";//收款账户开户银行 非必填
        String payeeBankNo = ""; //收款账户开户银行联行号 非必填
        String thirdBizOrderId = "";//第三方业务订单ID 非必填
        String payType = "";//支付类型 非必填 0 银行卡 1支付宝

        Substitution.submitBill(payeeName,payeeAccount,payeeIdCard,amount,thirdOrderId,payeePhone,payeeBankName,payeeBankNo,thirdBizOrderId,payType);
        /**********2.确认发放********************/
        String billId = "";//蓝犀返回的订单号
        String mainstayId = ""; //主体ID
        String invoiceCode = "JZZXFWZXFWF19"; //发票编号
//        Substitution.sureGrant(billId,mainstayId,invoiceCode);
        /**********3.发放结果查询*****************/
        List<String> thirdOrderIds = new ArrayList<>();//企业提交到蓝犀的订单号
        thirdOrderIds.add("xxxx");
//        PaymentResult.queryResult(thirdOrderIds);
        /**********4.余额查询********************/
        payType = "";
        Balance.balanceQuery(mainstayId,payType);
        /**********5.获取对账单*******************/
//        String date = "2019-07-20";
//        Reconciliation.companyReconciliation(date);

        /**********6.取消订单*********************/
//        String billId = "1227";//蓝犀返回的订单号
//        String reason = "错误订单人工取消"; //错误原因
//        Substitution.cancel(billId,reason);

        /**********7.查询用户本月还剩多少可发放金额**********************/
        AvailableCreditRequest availableCreditRequest = new AvailableCreditRequest();
//        List<String> idCards = new ArrayList<>(); //查询的用户身份证号码,最多一次性查询10个
//        idCards.add("xxxX");
//        idCards.add("xxxx");
//        idCards.add("xxxx");
//        availableCreditRequest.setMainstayId("1"); //主体ID
//        availableCreditRequest.setIdCards(idCards);
//        PersonAvailable.queryAvailable(availableCreditRequest);

        /**********8.查询公司发票信息以及主体信息**********************/
//        CompanyInfo.queryInvoicesAndMainstay();

        System.out.println("**********10.查询可开票订单列表**********************");
        OpenApiUnInvoiceRequest openApiUnInvoiceRequest = new OpenApiUnInvoiceRequest();
        openApiUnInvoiceRequest.setMainstayId("1"); //主体ID 不可空
        openApiUnInvoiceRequest.setInvoiceCode("XXJSFWJSFWF"); //发票编码 不可空
        openApiUnInvoiceRequest.setEndData(""); //开始时间 可空
        openApiUnInvoiceRequest.setStartData(""); //结束时间 可空
        Invoices.queryUnbilled(openApiUnInvoiceRequest);
//
//        System.out.println("**********11.上传提交的文件**********************");
//        String localPath = "C:/Users/dell/Desktop/注册服务协议.pdf"; //完整路径
//        Invoices.uploadFile(localPath);
//
        System.out.println("**********12.开票******************");
//        OpenApiCreateInvoiceRequest openApiCreateInvoiceRequest = new OpenApiCreateInvoiceRequest();
//        openApiCreateInvoiceRequest.setInvoiceTitle("xxxx有限公司");
//        openApiCreateInvoiceRequest.setAddressPhone("浙江省xxxxx 18779190994"); //公司地址、电话
//        openApiCreateInvoiceRequest.setArea("余杭区"); //收件人所在地区
//        openApiCreateInvoiceRequest.setBankAccount("xxxxz支行 6262451818181"); //开户行及账号
//        openApiCreateInvoiceRequest.setBillIds("1"); //订单ID 多个用英文逗号隔开例如 1,2,3,4
//        openApiCreateInvoiceRequest.setDetailAddress("浙江省余杭区"); //收件人详细地址
//        openApiCreateInvoiceRequest.setEmail("11111@qq.com"); //邮箱
//        openApiCreateInvoiceRequest.setTaxNumbe("xxxxxxxx"); //税号
//        openApiCreateInvoiceRequest.setInvoiceType("专票"); //发票类型 传普票,专票
//        openApiCreateInvoiceRequest.setPhone("1888888888"); // 收件人联系电话
//        openApiCreateInvoiceRequest.setRecipient("zhangws"); //收件人
//        openApiCreateInvoiceRequest.setRemark(""); //备注 可空
//        openApiCreateInvoiceRequest.setSceneDesc(""); //场景说明 可空
//        openApiCreateInvoiceRequest.setSceneFile(""); //场景文件 可空
//        openApiCreateInvoiceRequest.setBillDesc(""); //结算单说明 可空
//        openApiCreateInvoiceRequest.setBillFile(""); //结算单 可空
//        Invoices.createInvoice(openApiCreateInvoiceRequest);
//
        System.out.println("**********13.开票结果查询******************");
        String invoiceId = "发票单号";
        Invoices.detail(invoiceId);

        System.out.println("**********14.提交在线签约信息******************");
//        OpenApiPostCardInfoRequest openApiPostCardInfoRequest = new OpenApiPostCardInfoRequest();
//        openApiPostCardInfoRequest.setCardNo("");//银行卡号
//        openApiPostCardInfoRequest.setIdCard("");//身份证号
//        openApiPostCardInfoRequest.setRealName("");//真实姓名
//        openApiPostCardInfoRequest.setMobile("");//手机号
//        openApiPostCardInfoRequest.setSigningType(2);//签约类型2:银行卡四要素 3:运营商三要素
//        OnLineSign.sign(openApiPostCardInfoRequest);
        System.out.println("**********15.验证码确认签约******************");
//        OpenApiPostSignCheckCodeRequest openApiPostSignCheckCodeRequest = new OpenApiPostSignCheckCodeRequest();
//        openApiPostSignCheckCodeRequest.setCode("");//验证码
//        openApiPostSignCheckCodeRequest.setPersonAccountId("");//签约账户ID由上个接口获得
//        openApiPostSignCheckCodeRequest.setMobile(""); //签约手机号
//        OnLineSign.submit(openApiPostSignCheckCodeRequest);
        System.out.println("**********16.签约结果查询******************");
//        List<String> idCards = new ArrayList<>();
//        idCards.add("");//身份证号
//        idCards.add("");//身份证号
//        OnLineSign.querySignResult(idCards);
        System.out.println("**********17.充值******************");
//        OpenApiRechargeRequest openApiRechargeRequest = new OpenApiRechargeRequest();
//        openApiRechargeRequest.setAmount("");//打款金额 必填
//        openApiRechargeRequest.setBankVoucherFile(""); //打款凭证
//        openApiRechargeRequest.setMainstayId(""); //主体ID 必填
//        openApiRechargeRequest.setRemarks("充值备注"); // 充值备注
//        openApiRechargeRequest.setThirdRechargeNo(""); //第三方充值单号 必填
//        Balance.recharge(openApiRechargeRequest);

        System.out.println("**********18.提现******************");
//        OpenApiWithDrawRequest openApiWithDrawRequest = new OpenApiWithDrawRequest();
//        openApiWithDrawRequest.setTransAmount("");//提现金额 必填
//        openApiWithDrawRequest.setMainstayId(""); //提现主体ID 必填
//        openApiWithDrawRequest.setTransNo(""); //关联订单号。比如是对那一笔订单的提现则将该订单id的值填写即可 非必填
//        openApiWithDrawRequest.setThirdTransNo("");//第三方交易订单号 必填
//        Balance.withdraw(openApiWithDrawRequest);

        System.out.println("**********19.打款回调接口(第三方走自己打款渠道成功后回调修改订单状态)******************");
//        BillItemCallBackRequest billItemCallBackRequest = new BillItemCallBackRequest();
//        billItemCallBackRequest.setMessage(""); //返回信息 错误信息 非必填 建议填写不然不知道为什么失败
//        billItemCallBackRequest.setStatus(""); // 打款状态 必填 -100: 初始状态，待打款 0：转账中 1：转账成功  -1：转账失败 2：转账退款
//        billItemCallBackRequest.setThirdOrderId("");//第三方发放订单号 必填
//        Substitution.payCallBack(billItemCallBackRequest);

        System.out.println("**********20.个人信息认证******************");
        OpenApiPostCardInfoRequest apiPostCardInfoRequest = new OpenApiPostCardInfoRequest();
        apiPostCardInfoRequest.setCardNo(""); //银行卡号
        apiPostCardInfoRequest.setIdCard(""); //身份证号
        apiPostCardInfoRequest.setRealName(""); //真实姓名
        apiPostCardInfoRequest.setMobile(""); //手机号
        apiPostCardInfoRequest.setSigningType(0); //认证类型  0:三要素银行卡认证  1：二要素  2: 四要素 3运营商三要素
//        OnLineSign.personInfoCheck(apiPostCardInfoRequest);

        System.out.println("**********24.支付宝发放定制接口******************");
        String zfbpayeeName = "";//收款人姓名 必填
        String zfbpayeeAccount = "";////收款账户 必填
        String zfbpayeeIdCard = "";//收款人身份证号码 必填
        String zfbamount = "";//金额单位为元精确到分 必填
        String zfbthirdOrderId = "";//企业自己生成的订单号，不可重复提交 必填
        String zfbpayeePhone = "";//收款人手机号码 非必填
        String zfbpayeeBankName = "";//收款账户开户银行 非必填
        String zfbpayeeBankNo = ""; //收款账户开户银行联行号 非必填
        String zfbthirdBizOrderId = "";//第三方业务订单ID 非必填
        String zfbInvoiceCode = "";//发票编号必填
        String zfbMainstayId = ""; //主体 必填
//        Substitution.zfbSubmitBill(zfbpayeeName,zfbpayeeAccount,zfbpayeeIdCard,zfbamount,zfbthirdOrderId,zfbpayeePhone,zfbpayeeBankName,zfbpayeeBankNo,zfbthirdBizOrderId,zfbInvoiceCode,zfbMainstayId);

        System.out.println("**********25.支付宝个人信息认证******************");
        OpenApiPostCardInfoRequest apiPostCardInfoRequest1 = new OpenApiPostCardInfoRequest();
        apiPostCardInfoRequest1.setCardNo(""); //支付宝账户
        apiPostCardInfoRequest1.setIdCard(""); //身份证号
        apiPostCardInfoRequest1.setRealName(""); //真实姓名
//        OnLineSign.zfbPersonInfoCheck(apiPostCardInfoRequest);


        System.out.println("**********26.支付宝个人信息认证******************");
        String thirdOrderId1 = "";//第三方订单ID
        Reconciliation.queryVoucherUrl(thirdOrderId1);
	}
}
